﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace GifTools
{
    public static class ColorConverter
    {
        /// <summary>
        /// #FFFFFF => Color.White
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static Color ToColor(this string str)
        {
            string r = str.Substring(1, 2);
            string g = str.Substring(3, 2);
            string b = str.Substring(5, 2);
            return
                Color.FromArgb(
                    Convert.ToInt32(r, 16),
                    Convert.ToInt32(g, 16),
                    Convert.ToInt32(b, 16));
        }
    }
}
